{#
Copyright (c) 2020 Andy Zhou
MIT License
#}
{% extends 'base.html' %}
{% from 'bootstrap/pagination.html' import render_pagination %}
{% from 'macros.html' import role_label_of, static_file with context %}
{% block title %}{{ _('Manage users') }} {% endblock %}
{% block page_content %}
    <div class="row">
    <div class="col-lg-8">
    <ul class="list-group">
    {% for user in pagination.items %}
        <li class="list-group-item">
            <a href="{{ url_for('user.user_profile', username=user.username) }}"  class="profile-popover" data-href="{{ url_for('ajax.get_profile', user_id=user.id) }}">
                <img src="{{ user.gravatar() }}"></a>
            <a style="font-size: 2em" href="{{ url_for('user.user_profile', username=user.username) }}">{{ user.username }}</a>
            {{ role_label_of(user) }}<br><br>
            <span class="text-white">
                <a class="btn btn-sm btn-outline-secondary" href="{{ url_for('admin.edit_user_profile', id=user.id) }}">
                    <i class="fa fa-edit"></i>
                    {{ _('Edit Profile') }}
                </a>
                <form class="form-inline" method="POST" action="{{ url_for('admin.delete_user_account', id=user.id) }}"
                    style="display: inline !important">
                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                    <button class="btn btn-sm btn-outline-danger" onclick="{{ _('return confirm(\'Are you sure?\');') }}">
                        <i class="fa fa-trash"></i>
                        {{ _('DELETE') }}
                    </button>
                </form>
            </span>
        </li>
    {% endfor %}
    </ul>
    </div>
    {% include 'main/_sidebar.html' %}
    {{ render_pagination(pagination) }}
{% endblock page_content %}
